<template>
    <div>
      <h1>I am A Banana</h1>
      <button @click="addOne">minusOne</button>
      <button @click="minusOne">minusOne</button>
    </div>
</template>

<script>
    export default {
        name: 'Banana',
        data() {
            return {
                price:10
            }
        },
        methods: {
          addOne(){
            let vm=this
            vm.$store.commit('increment',vm.price)//操作state的值，看方法是写在action还是mutations里面
          },
          minusOne(){
            let vm=this
            vm.$store.commit('decrement',vm.price)
          },
        },
        computed: {},
        created() {
            const vm = this
        },
    }
</script>

<style>
</style>
